package com.sphd.restaurantsystem.adapters;

import android.content.Context;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sphd.restaurantsystem.R;
import com.sphd.restaurantsystem.info.InvestorInfo;
import com.wzh.frame.utils.BigDisMailUtils;
import com.wzh.frame.utils.TimeUtils;

import java.util.List;

/**
 * Created by Hu on 2016/11/3.
 */

public class InvestorAdapter extends BaseQuickAdapter<InvestorInfo> {
   private Context context;
    public InvestorAdapter(int layoutResId, List<InvestorInfo> data, Context context) {
        super(layoutResId, data);
        this.context=context;
    }

    @Override
    protected void convert(BaseViewHolder helper, InvestorInfo item) {
        helper.setText(R.id.i_name, item.getAccount_name()).setText(R.id.i_phone, item.getPhone()).setText(R.id.i_all_money,
                turn((item.getInvestment())))
        .setText(R.id.i_cut_money, turn(item.getInterest())).setBackgroundColor(R.id.item_layout,item.getAccount_status()==1?
                context.getResources().getColor(R.color.white):context.getResources().getColor(R.color.my_gray)).
                setText(R.id.i_time, TimeUtils.formatString(TimeUtils.DATE_FORMAT_DATE,item.getAccount_regtime()));

    }
    public String turn(Object val) {
        return BigDisMailUtils.turnTrim(val);
    }
}
